<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.biz.utils.ConfigUtil" %>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
    String resoursUrl = ConfigUtil.get("RESOURCES_URL");
%>

<!doctype html>
<html class="no-js"  style=" background: -webkit-gradient(linear, 0% 0%, 0% 100%,from(#FFFFFF), to(#FFFFFF)); padding-bottom:50px;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>充值卡</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" href="<%=resoursUrl%>resources/assets/css/dxy.css" />
  <jsp:include page="/jsp/inc_head.jsp"></jsp:include>

	<script>
		$(document).ready(function(){
			var maxheight = $(window).height() - 184 - 15 - 10 - 38 - 38 - 40 ;
			$(".rcgTabMain").css("max-height",maxheight);
			$("div.rcgTabtop:last").css("border-bottom","0")
		})
	</script>
	<style>
		html {
			height:100%;
		}
		.rechargeTop {
			 background-color: #fff;
		 }
		.iptconf{
			background-color: #ff4c00;
			color:#fff;
		}

	</style>
</head>

<body class="positionbody">
<div class="am-g rechargeTop">
	<input type="text" class="istpsw" style="border:1px solid #ff4c00" id="rechargeCode" placeholder="输入卡密" /><br/>
	<button type="button" class="iptconf" onclick="doRecharge();">确定</button>
</div>

<div class="am-g rechargeRecord">
	<div class="am-u-sm-12 rcgRecordmid">
		<div class="am-u-sm-12 rcgtitle">
			充值记录
		</div>
		<div class="am-u-sm-12 am-pad-none">
			<div class="am-u-sm-12 am-pad-none rcgTabtop">
				<div class="am-u-sm-4 am-pad-none">
                充值时间
            </div>
                <div class="am-u-sm-4 am-text-center am-pad-none">
                    充值卡号
                </div>
				<div class="am-u-sm-4 am-pad-none am-text-right">
					充值金额
				</div>
			</div>
			<div class="am-u-sm-12 am-pad-none rcgTabMain" id="list_recharge">

			</div>
		</div>
	</div>
</div>

<!--footer-->
<%--<jsp:include page="/jsp/inc_bottom.jsp"></jsp:include>--%>
<!--footer-->
<div class="am-modal am-modal-alert" tabindex="-1" id="my-alert">
	<div class="am-modal-dialog">
		<div class="am-modal-hd" id="alert_title">哎呦喂，出错啦</div>
		<div class="am-modal-bd" id="alert_message"></div>
		<div class="am-modal-footer">
			  <span class="am-modal-btn">确定</span>
		</div>
	</div>
</div>
<script>
	var pageIn=1;
     var ajaxpath="${pageContext.request.contextPath}";
     $(function () {
		 loadRecharge(1);
     });
	function loadRecharge (page) {
		//查询用户信息
		var url=ajaxpath+"/userCenter/getRecharge90.do?page="+page;
		$.get(url,function(data){
            if(data.list!=null&&data.list!=undefined&&data.list.length>0)
            {

                var html='';
                for(var i=0;i<data.list.length;i++)
                {
                    if(data.list[i].point_90!=undefined&&data.list[i].point_90!=null) {
                        var money = 0-parseFloat(data.list[i].point_90);
                        money = (money / 100).toFixed(2);
                        html+=' <div class="am-u-sm-12 am-pad-none rcgTabtop">';
                        html+='  <div class="am-u-sm-4 am-pad-none">';
                        html+=' <span class="rcgTime">'+data.list[i].create_time+'</span>';
                        html+=' </div>';
                        html+='  <div class="am-u-sm-4 am-text-center am-pad-none">';
                        html+=' <span class="rcgTime">'+data.list[i].card_number
                        +'</span>';
                        html+=' </div>';
                        html+='<div class="am-u-sm-4 am-pad-none am-text-right">';
                        html+='<span class="rcgNum">'+money+'</span>';
                        html+=' </div>';
                        html+=' </div>';
                    }


                }
				$("#list_recharge").append(html);

            }
		});
	}

    function doRecharge()
    {
        var rechargeCode=$("#rechargeCode").val();
        var url=ajaxpath+"/userCenter/do90Recharge.do?card_code="+rechargeCode;
        $.get(url,function(data){
            if(data.errmsg.toLowerCase()=='ok'.toLowerCase())
            {
                $("#alert_title").html("提示");
                $("#alert_message").html("操作成功");
                loadRecharge ()
            }
            else {

                $("#alert_message").html(data.errmsg);
            }
            $("#my-alert").modal('open');
        });
    }


    /*****加载商品信息--------开始****************/
    /** 下拉时调用 再次加载*/
    $(window).scroll(function()
    {
        /* console.log('top=' + $(window).scrollTop());
         console.log('height=' + $(window).height());
         console.log('documenth=' + $(document).height()); */
        if (($(window).scrollTop() + $(window).height() >= $(document).height()-50))
        {
            pageIn++;
            loadDetailIn(pageIn);
        }
    });
</script>
</body>
</html>
